
Ext.data.Association = Ext.extend(Object, {

    //Association所指向的模块（从模型）的主键名
    primaryKey: 'id',

    constructor: function (config) {
        Ext.apply(this, config);

        var types = Ext.ModelMgr.types,
            ownerName = config.ownerModel,           //主模型的注册名
            associatedName = config.associatedModel,//从模型的注册名
            ownerModel = types[ownerName],            //主模型的类
            associatedModel = types[associatedName],  //从模型l的类
            ownerProto;

        if (ownerModel == undefined) {
            throw new Error("The configured ownerModel was not valid (you tried " + ownerName + ")");
        }

        if (associatedModel == undefined) {
            throw new Error("The configured associatedModel was not valid (you tried " + associatedName + ")");
        }

        this.ownerModel = ownerModel;            //主模型的类
        this.associatedModel = associatedModel; //从模型l的类

        Ext.applyIf(this, {
            ownerName: ownerName,                //主模型的注册名
            associatedName: associatedName      //从模型的注册名
        });
    }
});